package com.servlet.homepage;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.entity.EasyBuy_order;
import com.entity.EasyBuy_product;
import com.entity.EasyBuy_user;
import com.service.EasyBuy_orderService;
import com.service.EasyBuy_orderServiceImpl;
import com.service.EasyBuy_productService;
import com.service.EasyBuy_productServiceImpl;
import com.service.EasyBuy_userService;
import com.service.EasyBuy_userServiceImpl;

/**
 * Servlet implementation class ShowAllInfoServlet
 */
public class ShowAllInfoServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ShowAllInfoServlet() {
        super();
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html; charset=UTF-8");
		
		Integer id = Integer.parseInt(request.getParameter("id"));
		
		EasyBuy_orderService orderService = new EasyBuy_orderServiceImpl();
		EasyBuy_order list2 = orderService.idSelectAll(id);
		
		EasyBuy_orderService orderService2 = new EasyBuy_orderServiceImpl();
		List<EasyBuy_order> list3 = orderService2.selectAllOrder(list2.getUserId());
		
		request.setAttribute("list2", list2);
		request.setAttribute("list3", list3);
		request.getRequestDispatcher("/back/Member_OrderList.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
